export default class AI extends Laya.Script {
    player=null;
    sign=" "
    owner=this.owner as Laya.Sprite
    // 更多参数说明请访问: https://ldc2.layabox.com/doc/?nav=zh-as-2-4-0
    
    constructor() { super(); }
    onAwake(){
        this.player=this.owner.parent.getChildByName("player")
        Laya.stage.on("gamer2",this,function(){this.owner.autoAnimation="Die"});
    }
    onUpdate(){
        Laya.Tween.to(this.owner,{x:this.player.x,y:this.player.y},10,null,null,null,true);
    }
    Init(sign){
        this.sign=sign;
        }
        onTriggerEnter(other){
        if(other.label=="bullet"){
            Laya.stage.event("+")
            
        this.owner.removeSelf();
        Laya.Pool.recover(this.sign,this.owner); 
        }
        }
}